import com.pojo.User;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.io.Reader;

import static org.apache.ibatis.io.Resources.getResourceAsReader;

public class UserTest {
    @Test
    public <SqlSessionFactory, sqlSession, sqlSessionFactoryBuilder> void userFindByIDTest(){
        String resources = "mybatis-config.xml";
        Reader reader=null;
        try {
            reader= getResourceAsReader(resources);
        }catch (IOException e) {
            e.printStackTrace();
        }
        sqlSessionFactoryBuilder sqlMapper = new
              sqlSessionFactoryBuilder.build(reader);
        sqlSession session=sqlMapper.openSession();
        User user=session.selsctOne("findById",1);
        System.out.println(user.getUname());
        session.close();
    }
}
